program eva;

var num:set of 0..9;
    site,i:integer;
    aa:array[1..9] of integer;

begin
  num:=[0..9];
  site:=1;
  while site>0 do
     begin
       if site>9 then
          begin
            for i:=1 to 9 do
              write(aa[i]);
            writeln;
            dec(site);
            num:=num+[aa[site]];
          end
       else
          begin
            inc(aa[site]);
            if aa[site]>9 then
              begin
                aa[site]:=0;
                dec(site);
                if site>0 then
                   num:=num+[aa[site]];
              end
            else
              begin
                if aa[site] in num then
                   begin
                     num:=num-[aa[site]];
                     inc(site);
                   end;
              end;
          end;
     end;
end.
